package com.example.bai10;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;

public class MainActivity extends Activity {
	Button btn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn= (Button) findViewById(R.id.btn);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.mymenu, menu);
        return true;
    }


	@Override
	public boolean onContextItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		
		switch (item.getItemId()) {
			case R.id.itemred:
			{
				btn.setTextColor(getResources().getColor(R.color.RED));
				break;
			}
			case R.id.itemgreen:
			{
				btn.setTextColor(getResources().getColor(R.color.GREEN));
				break;
			}
			case R.id.itemblue:
			{
				btn.setTextColor(getResources().getColor(R.color.BLUE));
				break;
			}
			default:
				break;
		}
		return super.onContextItemSelected(item);
	}
    
}
